<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 刘浩哲
  Date: 2022/11/24
  Time: 21:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="../static/css/dist/css/bootstrap.min.css">
</head>
<body>
<form action="add.shtml" method="post" enctype="multipart/form-data">
    <lable>商品名称:</lable>
    <input type="text" name="name"><br />
    <lable>副标题:</lable>
    <input type="text" name="title"><br />

    <label>分类名称:</label>
    <select name="cname">
        <c:forEach items="${requestScope.list1}" var="item">
            <option value="${item.classid}">${item.class_Name}</option>
        </c:forEach>
    </select><br />

    <label>品牌名称:</label>
    <select name="binfo">
        <c:forEach items="${requestScope.list}" var="item">
            <option value="${item.brandid}">${item.brand_Info}</option>
        </c:forEach>
    </select><br />
    <label>新增图片：</label>
    <img src="../upload" alt="" id="logo">
    <input type="file" name="image" id="pic">

    <label>商品描述信息:</label>
    <input type="text" name="sinfo"><br />
    <label>包装清单:</label>
    <input type="text" name="packing"><br />
    <label>售后服务:</label>
    <input type="text" name="service"><br />
    <label>是否下架:</label>
    <input type="text" name="takedown"><br />
    <input type="submit" class="btn btn-info" value="添加" >
</form>
</body>
<script src="../static/css/dist/js/jquery.min.js"></script>
<script>
    $(function (){
        $("#pic").on("change",function (){
            console.log(this.files[0]);
            var reader=new FileReader();
            reader.readAsDataURL(this.files[0]);
            reader.onload=function (){
                console.log(this.result);
                $("#logo").attr("src",this.result);
            };
        });
    });

</script>
</html>


